import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int[] array = new int[n+1];
            for(int i = 0; i < n ; i++){
                array[i] = in.nextInt();
            }
            int i = 0;
            int count = 0;
            while(i < n){
                if(array[i] < array[i+1]){
                   while(i < n && array[i] <= array[i+1]){
                    i++;
                  }
                    i++;
                    count++;
                }else if(array[i] == array[i+1]){
                    i++;
                }else{
                    while(i < n && array[i] >= array[i+1]){
                      i++;
                  }
                    i++;
                    count++;
                }
            }
            System.out.print(count);
    }
}